import React from 'react'
import { Col, Divider, Icon, Row } from 'antd'
import { TwsReactMarkdownPreview } from 'tws-antd'

export default class IntroductionBox extends React.Component {
  render () {
    const {resources, type} = this.props
    return <div style={{marginBottom: 10}}>
      <h3><b>{resources.title}</b></h3>
      <Row type='flex' justify='space-between'>
        <Col>
          <Icon type='solution' /> {resources.username}
        </Col>
        <Col>
          <Icon type='clock-circle' /> {resources.createTime}
          {type === 'serial'
            ? <span><Divider type='vertical' /><Icon type='folder-open' /> {resources.videos.length} 个视频</span>
            : ''
          }
        </Col>
      </Row>
      <Divider />
      <TwsReactMarkdownPreview source={resources.description} />
    </div>
  }
}
